﻿
namespace Jumpton.SFA.Server.Entity
{
    using System;
    using System.Collections.Generic;
    using System.Text;
    using Jumpton.Persistent;
    using System.Data;
    using System.Runtime.Serialization;
 


    [System.SerializableAttribute()]
    [RelationMap("Objective_Details", typeof(Objective_Details), "od")]
    [Relation(RelationJoinType.Inner, typeof(Objective), "o", "od", "ID", "Objective_ID")]
    

    public class ObjectiveDetailView : ObjectRow
    {

        public ObjectiveDetailView()
        {
        }

        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="dataRow">DataTable 中的一行数据</param>
        /// <param name="objectTable">存储当前对象的数据表格</param>
        public ObjectiveDetailView(System.Data.DataRow dataRow, ObjectTable parent) :
            base(dataRow, parent)
        {
        }

        /// <summary>
        /// 供反序列化使用的构造函数
        /// </summary>
        /// <param name="info"></param>
        /// <param name="context"></param>
        protected ObjectiveDetailView(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) :
            base(info, context)
        {
        }

        [Key("ID", TableAlias = "od")]
        public decimal ID
        {
            get
            {
                return (System.Decimal)GetValue("ID");
            }
            set
            {
                SetValue("ID", value);
            }
        }

        

        [Field("OBJECTIVE_ID", TableAlias = "od")]
        public int OBJECTIVEID
        {
            get
            {
                return (System.Int32)GetValue("OBJECTIVEID");
            }
            set
            {
                SetValue("OBJECTIVEID", value);
            }
        }

        [Field("KEYID", TableAlias = "od")]
        public int KEYID
        {
            get
            {
                return (System.Int32)GetValue("KEYID");
            }
            set
            {
                SetValue("KEYID", value);
            }
        }

        [Field("OBJECTID", TableAlias = "od")]
        public string OBJECTID
        {
            get
            {
                return (System.String)GetValue("OBJECTID");

            }
            set
            {
                SetValue("OBJECTID", value);
            }
        }

        [Field("OBJECTIVE_DATA", TableAlias = "od")]
        public decimal ObjectiveData
        {
            get
            {
                return (System.Decimal)GetValue("ObjectiveData");
            }
            set
            {
                SetValue("ObjectiveData", value);
            }
        }

        [Field("ACTUAL_DATA", TableAlias = "od")]
        public decimal ActualData
        {
            get
            {
                return (System.Decimal)GetValue("ActualData");
            }
            set
            {
                SetValue("ActualData", value);
            }
        }

        [Field("ACTUAL_DATA_TODAY", TableAlias = "od")]
        public decimal ActualDataToday
        {
            get
            {
                return (System.Decimal)GetValue("ActualDataToday");
            }
            set
            {
                SetValue("ActualDataToday", value);
            }
        }

        [Field("YEAR_MONTH", TableAlias = "od")]
        public string YEARMONTH
        {
            get
            {
                string date = (System.String)GetValue("YEARMONTH");
                if (date != "" && date.Length > 4)
                    date = date.Insert(4, "-");
                return date;
            }
            set
            {
                SetValue("YEARMONTH", value);
            }
        }

        [Field("ACTIVE", TableAlias = "od")]
        public bool Active
        {
            get
            {
                return (System.Boolean)GetValue("Active");
            }
            set
            {
                SetValue("Active", value);
            }
        }

          [Field("Name", TableAlias = "o")]
        public string Name {
            get {
                return (System.String)GetValue("Name");
            }
            set {
                SetValue("Name", value);
            }
        }

        [Field("Unit", TableAlias = "o")]
        public string Unit {
            get {
                return (System.String)GetValue("Unit");
            }
            set {
                SetValue("Unit", value);
            }
        }

        [Field("INPUTTYPE", TableAlias = "o")]
        public int INPUTTYPE {
            get {
                return (System.Int32)GetValue("INPUTTYPE");
            }
            set {
                SetValue("INPUTTYPE", value);
            }
        }

        [Field("OBJECTIVETYPE", TableAlias = "o")]
        public int OBJECTIVETYPE
        {
            get
            {
                try
                {
                    return (System.Int32)GetValue("OBJECTIVETYPE");
                }
                catch { return -1; }
            }
            set
            {
                SetValue("OBJECTIVETYPE", value);
            }
        }

       
    }
}
